package mincostmaxflow;

public class Edge  {
    public static final int INF = Integer.MAX_VALUE;
    public int source; // source node
    public int destination; // destination node
    public int cost; // cost of the edge
    public int capacity_or_flow;
    public boolean isReverse;
    private Edge() {}; // default constructor
    public Edge(int s, int d, int cost) { 
        source = s;
        destination = d;
        this.cost = cost;
        this.capacity_or_flow = 0;
    }

    public Edge(int s, int d, int cost, int capacity_or_flow, boolean isreverse) {
        this.source = s;
        this.destination = d;
        this.cost = cost;
        this.capacity_or_flow = capacity_or_flow;
        this.isReverse = isreverse;
    }
    public Edge(int s, int d, int cost, int capacity_or_flow) {
        this.source = s;
        this.destination = d;
        this.cost = cost;
        this.capacity_or_flow = capacity_or_flow;
        this.isReverse = false;
    }

    @Override
    public boolean equals(Object o){
        if(!(o instanceof Edge))
            return false;
        if(this == o)
            return true;
        Edge e = (Edge)o;
        if(//e.capacity_or_flow == this.capacity_or_flow &&
                //e.cost == this.cost &&
                e.source == this.source &&
                e.destination == this.destination)
            return true;
        return false;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 67 * hash + this.source;
        hash = 67 * hash + this.destination;
        hash = 67 * hash + this.cost;
        hash = 67 * hash + this.capacity_or_flow;
        return hash;
    }

    @Override
    public String toString(){
        return this.source + " - (" + this.cost + ") : (" + this.capacity_or_flow + ") ->" + this.destination;
    }
}
